package org.dce.screencapturer.actions.objects;

import java.awt.event.ActionEvent;

import org.dce.screencapturer.Drawing;
import org.dce.screencapturer.objects.DrawingObject;
import org.dce.screencapturer.util.IconFactory;

@SuppressWarnings("serial")
public class BringToFrontAction extends ObjectAction {

	public BringToFrontAction() {
		super("categories.object", "actions.bringToFront", IconFactory.getIcon("/images/bring-to-front.png"));
	}

	@Override
	protected boolean acceptObject(DrawingObject anObject) {
		return anObject instanceof DrawingObject;
	}

	@Override
	public void actionPerformed(ActionEvent event) {
		
		DrawingObject object = getObject();
		Drawing drawing = getDrawing();
		drawing.remove(object);
		drawing.add(object,0);
		drawing.repaint();

	}

}
